<template>
	<view class="invoice-info-layout">
		<xh-header title="开票信息" color="#333333"></xh-header>
		<view class="invoice-info-cell">
			<text>公司名称</text>
			<text>{{tickInfo['公司名称']}}</text>
			<view class="line"></view>
		</view>
		<view class="invoice-info-cell">
			<text>公司地址</text>
			<text>{{tickInfo['公司地址']}}</text>
			<view class="line"></view>
		</view>
		<view class="invoice-info-cell">
			<text>固定电话</text>
			<text>{{tickInfo['固定电话']}}</text>
			<view class="line"></view>
		</view>
		<view class="invoice-info-cell">
			<text>开户行</text>
			<text>{{tickInfo['开户行']}}</text>
			<view class="line"></view>
		</view>
		<view class="invoice-info-cell">
			<text>开户账号</text>
			<text>{{tickInfo['开户帐号']}}</text>
			<view class="line"></view>
		</view>
		<view class="invoice-info-cell">
			<text>税号</text>
			<text>{{tickInfo['税号']}}</text>
			<view class="line"></view>
		</view>
		<view class="invoice-info-cell">
			<text>发票种类</text>
			<text>{{tickInfo['发票种类']}}</text>
			<view class="line"></view>
		</view>
		<view class="invoice-info-cell">
			<text>开票摘要</text>
			<text>{{tickInfo['开票摘要']}}</text>
			<view class="line"></view>
		</view>
		<xh-header title="收件信息" color="#333333"></xh-header>
		<view class="invoice-info-cell">
			<text>收件人</text>
			<text>{{tickAddress['收件人']}}</text>
			<view class="line"></view>
		</view>
		<view class="invoice-info-cell">
			<text>邮寄地址</text>
			<text>{{tickAddress['邮寄地址']}}</text>
			<view class="line"></view>
		</view>
		<view class="invoice-info-cell">
			<text>联系电话</text>
			<text>{{tickAddress['联系电话']}}</text>
			<view class="line"></view>
		</view>
	</view>
</template>

<script setup>
	import { onLoad } from '@dcloudio/uni-app'
	import { ref } from 'vue'
	import { getInvoiceInfo } from '@/common/api/api.js'
	
	const tickAddress = ref({})
	const tickInfo = ref({})
	
	const getInvoiceInfoData = async () => {
		const res = await getInvoiceInfo()
		tickAddress.value = JSON.parse(res.result.tickAddress)
		tickInfo.value = JSON.parse(res.result.tickInfo)
	}
	onLoad(() => {
		getInvoiceInfoData()
	})
</script>

<style lang="scss" scoped>
	.invoice-info-layout {
		.invoice-info-cell {
			background-color: #fff;
			padding: 30rpx;
			display: flex;
			justify-content: space-between;
			position: relative;

			text:nth-child(1) {
				margin-right: 60rpx;
				flex-shrink: 0;
			}
		}
	}
</style>